<html>

<head>

<title>JS - 函数</title>
<meta charset="utf-8">
<style>
.layui-side {
    position: relative;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 999;
    width: 200px;
	height:400px;
    overflow-x: hidden;
}
.layui-side-scroll {
    position: relative;
    width: 220px;
    height: 100%;
    overflow-x: hidden;
}
</style>

</head>

 <body>

<div class="layui-side layui-bg-black">
	<div id='scroll' class="layui-side-scroll">
	<table>
		<tbody id='tbdy'></tbody>
	</table>
	</div>
</div>

<div id='animateDiv' style='width:200px;height:100px;margin-top:30px;background-color:#ccc'></div>

<script>

var General = function() {};

General.prototype.flg = 'This is General';

General.prototype.say = function() {
	alert('General -- say');
};


var F = function(id, name) {
console.log(this,'===Fd this==')
	this.id = id;
	this.name = name;
}

F.prototype.attr = 'prototype';

F.prototype.talk = function() {
	alert('prototype -- talk');
};

F.prototype.__proto__ = General.prototype; //原型链指向General原型属性，形成继承关系

var f = new F('123', 'zly');
console.log(F,'===f===')

f.attr = 'f'; //覆盖原型链属性

/**
f.talk = function() {
	alert('f.talk');
};
**/

f.say();

/**
1、找自己的属性，若没有，则进行第二步
2、往上游原型链找属性。若没有，则进行第二步
3、返回undefined
**/

console.log('f-->', f);
console.log('f.constructor-->', f.constructor);
console.log('f.__proto__-->', f.__proto__); //原型链，指函数prototype
console.log('f.toString-->', f.toString());
console.log('F-->', F);
console.log('F.prototype-->', F.prototype); F.prototype //函数原型链属性集合
console.log('F.__proto__-->', F.__proto__);
console.log('f.__proto__ == F.prototype-->', f.__proto__ == F.prototype);

function f2(){
	var b = 2;
	b = f1();
	console.log(b,'====b====')
}
f2();

function f1(){
	return  f3();
}
function f3(){
 
	return 3;
}


</script>

  </body>

</html>